/**
 * Created by chenyong on 2015/11/6.
 * 封装后端Api，给前端程序调用
 * 此处仅定义Api路由
 */

var express = require('express');
var router = express.Router();
var panoctl = require('./pano.service');
var panotagctl = require('./panotag.service');
var gamectl = require('./game.service');
var wechatsign=require('./wechatsignature.service');
var commentctl=require('./comment.service');

//微信票据
router.get('/wechat/getsignature',wechatsign.getsignature);

//panos应用
router.get('/panos/',panoctl.getPanos);
router.get('/panos/:id/',panoctl.getPanoInfo);

//用户标注点
router.get('/panos/:panoid/usertags',panotagctl.getUserTags);
//创建用户标注点
router.post('/panos/:panoid/usertags',panotagctl.createUserTag);
//修改用户标注点
router.put('/panos/:panoid/usertags/:id',panotagctl.updateUserTag);

//根据用户Id查询
router.get('/panos/:panoid/usertags/fetchbyuserId/',panotagctl.fetchTagsbyUserId);
//返回随机的用户标注点
router.get('/panos/:panoid/usertags/randomusertags',panotagctl.getRandomUserTags);



//粉丝
router.get('/panos/:id/fans',panotagctl.fans);
//获取标注点信息
router.get('/panos/:id/tags',panotagctl.gettags);
//设置标签
router.post('/panos/:id/tags',panotagctl.settags);
//获取某个用户的标注信息
router.get('/panos/:panoid/getusertags',panotagctl.getUserTags);


//留言
router.get('/comment/:id',commentctl.getComments);
router.post('/comment/:id',commentctl.createComment);
router.delete('/comment/:id/redis',commentctl.cleanRedisComments);
router.get('/comment/:id/redis',commentctl.getRedisComments);


//游戏应用
//读取用户当前积分
router.get('/games/:id/score',gamectl.score);
//添加积分
router.post('/games/:id/score',gamectl.savescore);
//分页排名
router.get('/games/:id/rank',gamectl.rank);
//获取用户当前游戏详细
router.get('/games/:id/records',gamectl.records);


module.exports = router;